﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Microsoft.Popfly.GameCreator.GameEngine.Events
{
    public static class TimerEventCheckerFactory
    {
        public static IEventChecker CreateTimerEventChecker(Game game, Data.TimerEventInfo eventInfo)
        {
            switch (eventInfo.TimerType)
            {
                case Data.TimerEventInfo.TimerEventType.EveryFrame :
                    return new EveryFrameChecker(game);
                case Data.TimerEventInfo.TimerEventType.Random :
                    return new RandomIntervalChecker(game, eventInfo.MinValue, eventInfo.MaxValue);
                case Data.TimerEventInfo.TimerEventType.Regular :
                    return new RegularIntervalChecker(game, eventInfo.MinValue);
                default :
                    throw new NotImplementedException(
                        Utils.ErrorMessagePrefix +
                        "We only know how to make timers of types 'EveryFrame', 'Random' and 'Regular'.  " +
                        "The type passed in to CreateTimerEventChecker was '" +
                        eventInfo.TimerType.ToString() +
                        "'.");
            }
        }
    }
}
